const EventEmitter = require("events").EventEmitter;

class Emitter extends EventEmitter {}

const TaskMessageEvent = new Emitter();

/**
 * 
 * @param {Function} cb 
 */
const  TaskPostMessage = (cb)=>{
    TaskMessageEvent.on("taskMessage",(data)=>{
        cb.call(this,data)
    })
}

const  TaskMessageEmit = (data)=>{
    TaskMessageEvent.emit('taskMessage',data)
}

module.exports = {
    TaskPostMessage,
    TaskMessageEmit,
}